home *** CD-ROM | disk | FTP | other *** search
-
- MSGSND(2) UNIX Programmer's Manual MSGSND(2)
-
- NNAAMMEE
- mmssggssnndd - send a message to a message queue
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
- ##iinncclluuddee <<ssyyss//iippcc..hh>>
- ##iinncclluuddee <<ssyyss//mmssgg..hh>>
-
- _i_n_t
- mmssggssnndd(_i_n_t _m_s_q_i_d, _v_o_i_d _*_m_s_g_p, _s_i_z_e___t _m_s_g_s_z, _i_n_t _m_s_g_f_l_g)
-
- DDEESSCCRRIIPPTTIIOONN
- The mmssggssnndd() function sends a message from the message queue specified in
- _m_s_q_i_d. _m_s_g_p points to a structuer containing the message. This structure
- should consist of the following members:
-
- long mtype; /* message type */
- char mtext[1]; /* body of message */
-
- _m_t_y_p_e is an integer greater than 0 that can be used for selecting mes-
- sages (see msgrcv(2)), _m_t_e_x_t is an array of bytes, with a size up to
- that of the system limit (MSGMAX).
-
- If the number of bytes already on the message queue plus _m_s_g_s_z is bigger
- than the maximum number of bytes on the message queue ( _m_s_g___q_b_y_t_e_s, see
- msgctl(2)), or the number of messages on all queues system-wide is al-
- ready equal to the system limit, _m_s_g_f_l_g determines the action of
- mmssggssnndd(). If _m_s_g_f_l_g has IPC_NOWAIT mask set in it, the call will return
- immediately. If _m_s_g_f_l_g does not have IPC_NOWAIT set in it, the call will
- block until:
-
- ++oo The condition which caused the call to block does no longer exist.
- The message will be sent.
-
- ++oo The messag queue is removed, in which case -1 will be returned, and
- _e_r_r_n_o is set to EINVAL.
-
- ++oo The caller catches a signal. The call returns with _e_r_r_n_o set to EIN-
- TR.
-
- After a successful call, the data structure associated with the message
- queue is updated in the following way:
-
- ++oo _m_s_g___c_b_y_t_e_s is incremented by the size of the message.
-
- ++oo _m_s_g___q_n_u_m is incremented by 1.
-
- ++oo _m_s_g___l_s_p_i_d is set to the pid of the calling process.
-
- ++oo _m_s_g___s_t_i_m_e is set to the current time.
-
- RREETTUURRNN VVAALLUUEESS
- Upon successful completion, 0 is returned. Otherwise, -1 is returned and
- _e_r_r_n_o is set to indicate the error.
-
- EERRRROORRSS
- mmssggssnndd() will fail if:
-
- [EINVAL] _m_s_q_i_d is not a valid message queue identifier
-
- The message queue was removed while mmssggssnndd() was waiting
- for a resource to become available in order to deliver the
- message.
-
- _m_s_g_s_z is less than 0, or greater than _m_s_g___q_b_y_t_e_s.
-
- [EACCESS] The calling process does not have write access to the mes-
- sage queue.
-
- [EAGAIN] There was no space for this message either on the queue, or
- in the whole system, and IPC_NOWAIT was set in _m_s_g_f_l_g.
-
- [EFAULT] _m_s_g_p points to an invalid address.
-
- [EINTR] The system call was interrupted by the delivery of a sig-
- nal.
-
- BBUUGGSS
- NetBSD does not define the EIDRM error value, which should be used in the
- case of a removed message queue.
-
- HHIISSTTOORRYY
- Message queues appeared in the first release of AT&T Unix System V.
-
- NetBSD August 17, 1995 2
-